﻿package src.panel 
{
	import debugs.Debug;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	import gs.TweenMax;
	/**
	 * ...
	 * @author keys_star@163.com
	 */
	public class light extends Sprite
	{
		private var total:uint = 26;
		private var item:Array;
		private var color:Array;
		private var timers:Timer;
		private var id = 0;
		private var oldC:uint;
		public function light() 
		{
			
			initColor();
			initItem();
			setColor(null);
			run();
		}
		private function initItem() {
			item = new Array;
			for (var i = 0; i < total; i++ ) {
				var mc = getChildByName("l" + i);
				item.push(mc);
			}
		}
		private function initColor() {
			color = new Array;
			color.push(0xff0000)
			color.push(0x00ff00)
			color.push(0x0000ff)
		}
		private function setColor(e) {
			for (var i = 0; i < total; i++ ) {
				color.push(color.shift());
				TweenMax.to(item[i], 0, {colorMatrixFilter:{colorize:color[0]}});
			}
		}
		private function run() {
			timers = new Timer(500, 0);
			timers.addEventListener(TimerEvent.TIMER, setColor);
			timers.start();
		}
	}
}